﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <title>添加覆盖物-点</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style>
    code{
    background: none repeat scroll 0 0 #F5F5F5;
    border: 1px dotted #778855;
    font-family: "Courier New",monospace;
    font-size: 12px;
    padding: 5px;
    width: 500px;}
    </style>
    <script type="text/javascript" src="proj/resources/javascript/jquery/jquery-1.5.2.min.js"></script>
    <script type="text/javascript" src="proj/resources/javascript/flashmap/flashmap_all.js"></script>
    <script type="text/javascript">
        $(function(){
			$("body").prepend($("<a>").attr("href","http://code.google.com/p/njcjtx/source/browse/trunk/samples/"+$("title").text()+".html").attr("target","blank").text("查看页面源码(Google Code)"));
			
            var onMapLoadHandler = function(){
                //设置当前显示区域
                map.extent([13199146.044280795, 3697106.1840964477, 13705159.17152842, 3843865.278403916]);
            
				$("#btnAddPnt").click(function(){
					//iMap.MapPoint方法，获得一个几何点对象
					var pnt = iMap.MapPoint({
						x:13222841.52304909,
						y:3772931.7161553074
					});
					//iMap.Graphic方法，获得一个地图覆盖物对象
					var mark = iMap.Graphic({
						geometry:pnt
					});
					//向地图客户端图层添加地图覆盖物对象
					map.clientLayer.add(mark);
				});
			};
            
            map = new iMap({
                dom:"flashContent",
                type:"street",
                width:"100%",
                height:300,
                onLoad:onMapLoadHandler
            });
        });
    </script>
    </head>
    <body>
        <div id="flashContent" style="border:solid 1px"></div>
        <div id="demo" style="postion:absolute;">
            <fieldset>
                <legend><input id="btnAddPnt" type="button" value="添加点"></input></legend>
                <code>
				var pnt = iMap.MapPoint({
					x:13505159.17152842,
					y:3843865.278403916
				});
				var mark = iMap.Graphic({
					geometry:pnt
				});
				map.clientLayer.add(mark);
				</code>
            </fieldset>
        </div>
    </body>
</html>
